package serialize;

import utils.Log;

public class GsonTest2 {

    static class BaseModel {
        private int x;
        String y;

        BaseModel() {
            this.x = 2;
            this.y = "y";
        }

        @Override
        public String toString() {
            return "BaseModel{" +
                    "x=" + x +
                    ", y='" + y + '\'' +
                    '}';
        }
    }

    public static void main(String[] args) throws Exception {
        BaseModel model = new BaseModel();
        model.x = 1;
        String json = GsonUtils.toGsonString(model);
        Log.vn("model:" + json);

        model = GsonUtils.fromJson(json, BaseModel.class);
        Log.vn("model:" + model);
    }

}
